import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';

@inject('myStore')
@observer
class Component2 extends Component {

  changeName = (e) => {
    this.props.myStore.name = e.target.value;
  }

  changeInfo = (e) => {
    this.props.myStore.changeInfo(e.target.value);
  }

  render() {
    return (
      <div>
        <span>组件2 -</span>
        <span> name: </span>
        <input type="text" value={this.props.myStore.name} onChange={this.changeName} />
        <span> info: </span>
        <input type="text" value={this.props.myStore.info} onChange={this.changeInfo}/>
        <p>全名： <span>{this.props.myStore.fullName}</span></p>
      </div>
    )
  }
}

export default Component2;